package darknet.core.spec.net;

import java.io.IOException;


/**
 * A protocol sender, useful to send a message.
 * 
 * @author Yoyo
 */
public interface ProtocolSender {

    /**
     * Return true if this protocol sender can send a message, 
     * false otherwise.
     * 
     * @param toSend The message to hand.
     * @return
     */
    boolean canSend(Message toSend);
    
    /**
     * Send a given message.
     * 
     * @param toSend The message to hand.
     * @return The response
     */
    Response send(StreamableMessage toSend) throws IOException;
}
